package org.xbzheng.boot.web;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.xbzheng.boot.bean.Result;
import org.xbzheng.boot.bean.User;
import org.xbzheng.boot.config.JdbcProperties;
import org.xbzheng.boot.service.UserService;

@RestController
public class LoginCtrl {

    @Autowired
    private UserService userService;

    @Autowired
    JdbcProperties properties;
    @RequestMapping(value = "/login", method = RequestMethod.PUT)
    @ResponseBody
    public Result login(User user){
        User result = userService.query(user);
        System.out.println("ddddddd");
        if (result == null){
            return Result.error();
        }
        return Result.ok(properties);
    }
}
